package com.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;

@Controller
@RequestMapping(path = "demo")
public class DemoController {

    @GetMapping(path = "/getView")
    public ModelAndView testMethod() {
        Date now = new Date();
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("now", now);
        modelAndView.setViewName("success");
        return modelAndView;
    }

}
